package com.itheima.controller;

import com.itheima.exception.CustomException;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController {
    @RequestMapping("/login")
    public Map login(Integer id,String username,String password) throws Exception {
//        if (StringUtils.isEmpty(username)) {
//            //自定义异常抛出
//            throw new CustomException("用户名不能为空");
//        }
        //抛出非自定义异常
        int i = 1/0;
        Map result = new HashMap();
        result.put("msg","login ok ...");
        result.put("data","");
        return result;
    }
}
